Basti's Scratchpad on the Internet

解决Windows上程序运行时的side by side错误

起因

前两天写了个小工具,在我的机器跑得好好的,QA的测试机里面却死活跑不起来,一运行就出现一个对话框,报一个side by side的错误:

The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.

郁闷至极,不过这个对话框却提供了一点额外的信息:

use the command-line sxstrace.exe tool for more detail

于是Google了一下,sxstrace.exe是一个跟踪调试应用程序的工具,看起来很不错的样子。

解决过程

按照这个帖子,先打开sxstrace.exe的调试模式:

sxstrace trace -logfile:C:/trace.bin

然后再打开应用程序,这时候在C盘根目录的trace.bin已经生成了,于是退出sxstrace,再运行以下命令:

sxstrace parse -logfile:C:/trace.bin -outfile:C:/trace.log

因为sxstrace trace出来的文件是二进制的,所以用上述命令将其转换成txt的。

打开trace.log,内容如下:

=================
Begin Activation Context Generation.
Input Parameter:
    Flags = 0
    ProcessorArchitecture = Wow32
    CultureFallBacks = en-US;en
    ManifestPath = C:\Users\ADMINI~1\AppData\Local\Temp\1\7zS4BF7914E\installer.exe
    AssemblyDirectory = C:\Users\ADMINI~1\AppData\Local\Temp\1\7zS4BF7914E\
    Application Config File =
-----------------
INFO: Parsing Manifest File C:\Users\ADMINI~1\AppData\Local\Temp\1\7zS4BF7914E\installer.exe.
    INFO: Manifest Definition Identity is (null).
    INFO: Reference: Microsoft.VC90.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8"
INFO: Resolving reference Microsoft.VC90.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8".
    INFO: Resolving reference for ProcessorArchitecture WOW64.
        INFO: Resolving reference for culture Neutral.
            INFO: Applying Binding Policy.
                INFO: No publisher policy found.
                INFO: No binding policy redirect found.
            INFO: Begin assembly probing.
                INFO: Did not find the assembly in WinSxS.
                INFO: Attempt to probe manifest at C:\Windows\assembly\GAC_32\Microsoft.VC90.CRT\9.0.21022.8__1fc8b3b9a1e18e3b\Microsoft.VC90.CRT.DLL.
                INFO: Did not find manifest for culture Neutral.
            INFO: End assembly probing.
    INFO: Resolving reference for ProcessorArchitecture x86.
        INFO: Resolving reference for culture Neutral.
            INFO: Applying Binding Policy.
                INFO: No publisher policy found.
                INFO: No binding policy redirect found.
            INFO: Begin assembly probing.
                INFO: Did not find the assembly in WinSxS.
                INFO: Attempt to probe manifest at C:\Windows\assembly\GAC_32\Microsoft.VC90.CRT\9.0.21022.8__1fc8b3b9a1e18e3b\Microsoft.VC90.CRT.DLL.
                INFO: Attempt to probe manifest at C:\Users\ADMINI~1\AppData\Local\Temp\1\7zS4BF7914E\Microsoft.VC90.CRT.DLL.
                INFO: Attempt to probe manifest at C:\Users\ADMINI~1\AppData\Local\Temp\1\7zS4BF7914E\Microsoft.VC90.CRT.MANIFEST.
                INFO: Attempt to probe manifest at C:\Users\ADMINI~1\AppData\Local\Temp\1\7zS4BF7914E\Microsoft.VC90.CRT\Microsoft.VC90.CRT.DLL.
                INFO: Attempt to probe manifest at C:\Users\ADMINI~1\AppData\Local\Temp\1\7zS4BF7914E\Microsoft.VC90.CRT\Microsoft.VC90.CRT.MANIFEST.
                INFO: Did not find manifest for culture Neutral.
            INFO: End assembly probing.
    ERROR: Cannot resolve reference Microsoft.VC90.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8".
ERROR: Activation Context generation failed.
End Activation Context Generation.

看起来是 Microsoft.VC90.CRT.dll 这个reference没有找到,这个是属于 Visual C++ 2008 Redistributable 的一个动态链接库。去M$的网站下一个装上,一切就OK了。

总结

对于windows我一向没有好感,不评价,写这篇blog主要是为了记录 sxstrace.exe 这个工具,感觉用来debug不错。

Other posts
comments powered by Disqus